<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="UTF-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<title>let 命令-不允许重复声明</title> 
<script> 
var x = 3; 
var x = 4; 
 console.log(x); // 单独运行结果为 4 
 //如果与下面代码一起运行，则无结果，因为下面代码属于编译错误 
 let y = 1; 
 let y = 2; 
 console.log(y); // Identifier 'y' has already been declared 
 </script> 
 </head> 
 <body></body> 
 </html> 
